package com.ward.thread;

/**
 * Created by ward on 2017-08-24.
 */
public class TestThread {
    public static void main(String[] args) {
        Runner2 t1 = new Runner2("rer");
        t1.start();
        try {
            t1.join();
        } catch (InterruptedException e) {

        }
        for (int i = 1; i <= 10; i++) {
            System.out.println("I am Thread");
        }
    }
}

class Runner2 extends Thread {
    Runner2(String s) {
        super(s);
    }

    public void run() {
        for (int i = 0; i <= 10; i++) {
            System.out.println("I am " + getName());
        }
        try {
            sleep(1000);
        } catch (InterruptedException e) {
            return;
        }
    }

}
